{% extends 'layout.html' %}
{% block title %}{{ station.station_name }}{% endblock %}
{% block content %}
<div class="row">
    <div class="col" align="center">
        <p><h2>添加基于换电步骤的巡检规则</h2></p>
        <p><h3>{{station.station_name}}</h3></p>
        <form action="/ai_inspect/step_rule_create/{{station.station_id}}/" method="POST" id="inspect_rule_create">
            {% csrf_token %}
            <input type="hidden" name="station" value="{{station.station_id}}">
            <input type="hidden" name="activate" value="True">
            <table class="table table-striped">
                <tr>
                    <td>巡检算法名称</td>
                    <td>
                        <select class="form-control" name="algorithm" required>
                            <option value="">请选择</option>
                            {% for algorithm in algorithms %}
                                <option value="{{algorithm.algorithm_name}}">{{algorithm.algorithm_name}}</option>
                            {% endfor %}
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>摄像头名称</td>
                    <td>
                        <select class="form-control" name="channel" required>
                            <option value="">请选择</option>
                            {% if channels %}
                                {% for channel in channels %}
                                    <option value="{{channel.channel_id}}">{{channel.channel_name}}</option>
                                {% endfor %}
                            {% endif %}
                        </select>
                    </td>
                </tr>
                <tr>
                    <td>基于换电步骤</td>
                    <td>
                    {% if steps %}
                        <select name="step" class="form-control" required>
                            <option></option>
                            {% for step in steps %}
                                <option value="{{step.step_id}}">{{step.step_code}}-{{step.step_description}}</option>
                            {% endfor %}
                        </select>
                    {% endif %}
                    </td>
                </tr>
                <tr>
                    <td><button type="reset" class="btn btn-danger btn-block">重置</button></td>
                    <td><button type="submit" class="btn btn-primary btn-block">提交</button></td>
                </tr>
            </table>
        </form>
        <script>
          $(document).ready(function() {
            $('#inspect_rule_create').validate();
          });
        </script>
    </div>
</div>
{% endblock %}